How can I declare a pointer structure using {}?
Posted
by Y_Y
on Stack Overflow
See other posts from Stack Overflow
or by Y_Y
Published on 2010-04-27T03:50:08Z
Indexed on
2010/04/27
4:03 UTC
Read the original article
Hit count: 178
This probably is one of the easiest question ever in C programming language...
I have the following code:
typedef struct node
{
int data;
struct node * after;
struct node * before;
}node;
struct node head = {10,&head,&head};
Is there a way I can make head to be *head [make it a pointer] and still have the availability to use '{ }' [{10,&head,&head}] to declare an instance of head and still leave it out in the global scope?
For example:
//not legal!!!
struct node *head = {10,&head,&head};
© Stack Overflow or respective owner